package com.vf.admin.utils.ip;

import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Map;

/**
 * <p>Title : ip判断</p>
 * <p>Description : </p>
 * <p>DevelopTools : IDEA</p>
 * <p>DevelopSystem : Windows11</p>
 *
 * @Author : zxw
 * @Date 2023/9/18 18:22
 */
@Component
@EnableScheduling
public class IpTimerController {



    @Scheduled(cron = "0 0 1 * * ?")
//    @Scheduled(cron = "*/5 * * * * ?")
    public void getIpTxt() {

        //获取数据
        Map<String, Object> ipList = IpUtils.getIpList();
        //更新数据
        IpConstant.ip.clear();
        IpConstant.ip.putAll(ipList);
        System.out.println(IpConstant.ip);
    }
}
